home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
p_man
/
cat3c
/
gettimeofday.z
/
gettimeofday
Wrap
Text File
|
1998-10-20
|
6KB
|
133 lines
GGGGEEEETTTTTTTTIIIIMMMMEEEEOOOOFFFFDDDDAAAAYYYY((((3333BBBB)))) GGGGEEEETTTTTTTTIIIIMMMMEEEEOOOOFFFFDDDDAAAAYYYY((((3333BBBB))))
NNNNAAAAMMMMEEEE
gettimeofday, settimeofday - get/set date and time
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttiiiimmmmeeee....hhhh>>>>
_X_P_G_4:
iiiinnnntttt ggggeeeettttttttiiiimmmmeeeeooooffffddddaaaayyyy((((ssssttttrrrruuuucccctttt ttttiiiimmmmeeeevvvvaaaallll ****ttttpppp,,,, vvvvooooiiiidddd ****ttttzzzzpppp))));;;;
_S_y_s_t_e_m _V:
iiiinnnntttt ggggeeeettttttttiiiimmmmeeeeooooffffddddaaaayyyy((((ssssttttrrrruuuucccctttt ttttiiiimmmmeeeevvvvaaaallll ****ttttpppp,,,, ............))));;;;
iiiinnnntttt sssseeeettttttttiiiimmmmeeeeooooffffddddaaaayyyy((((ssssttttrrrruuuucccctttt ttttiiiimmmmeeeevvvvaaaallll ****ttttpppp,,,, ............))));;;;
_B_S_D:
iiiinnnntttt BBBBSSSSDDDDggggeeeettttttttiiiimmmmeeeeooooffffddddaaaayyyy((((ssssttttrrrruuuucccctttt ttttiiiimmmmeeeevvvvaaaallll ****ttttpppp,,,, ssssttttrrrruuuucccctttt ttttiiiimmmmeeeezzzzoooonnnneeee ****ttttzzzzpppp))));;;;
iiiinnnntttt BBBBSSSSDDDDsssseeeettttttttiiiimmmmeeeeooooffffddddaaaayyyy((((ssssttttrrrruuuucccctttt ttttiiiimmmmeeeevvvvaaaallll ****ttttpppp,,,, ssssttttrrrruuuucccctttt ttttiiiimmmmeeeezzzzoooonnnneeee ****ttttzzzzpppp))));;;;
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
The system's notion of the current time is obtained with the _g_e_t_t_i_m_e_o_f_d_a_y
and _B_S_D_g_e_t_t_i_m_e_o_f_d_a_y calls. The time is expressed in seconds and
microseconds since midnight (00:00) Coordinated Universal Time (UTC),
January 1, 1970. The resolution for (_B_S_D)_g_e_t_t_i_m_e_o_f_d_a_y is never worse
than 100 HZ (which equals 10 milliseconds). The actual resolution of
(_B_S_D)_g_e_t_t_i_m_e_o_f_d_a_y depends on the timer capability of the underlying
hardware(see _t_i_m_e_r_s(_5)).
The difference between the calls _g_e_t_t_i_m_e_o_f_d_a_y(_s_e_t_t_i_m_e_o_f_d_a_y) and
_B_S_D_g_e_t_t_i_m_e_o_f_d_a_y(_B_S_D_s_e_t_t_i_m_e_o_f_d_a_y) is the additional second argument _t_z_p in
the latter.
In IRIX, the time zone used by each process is determined by the TZ
environment variable. The _t_z_p argument is present in the BSD calls only
for compatibility. It cannot be used to set the time zone for the
system, and so must be zero for _s_e_t_t_i_m_e_o_f_d_a_y. If _t_z_p is not zero,
_B_S_D_g_e_t_t_i_m_e_o_f_d_a_y will return an interpretation of the TIMEZONE environment
variable.
The structures pointed to by _t_p and _t_z_p are defined in <_s_y_s/_t_i_m_e._h> as:
struct timeval {
time_t tv_sec; /* seconds since Jan. 1, 1970 */
long tv_usec; /* and microseconds */
};
struct timezone {
int tz_minuteswest; /* of Greenwich */
int tz_dsttime; /* type of dst correction to apply */
};
PPPPaaaaggggeeee 1111
GGGGEEEETTTTTTTTIIIIMMMMEEEEOOOOFFFFDDDDAAAAYYYY((((3333BBBB)))) GGGGEEEETTTTTTTTIIIIMMMMEEEEOOOOFFFFDDDDAAAAYYYY((((3333BBBB))))
The _t_i_m_e_z_o_n_e structure indicates the local time zone (measured in minutes
of time westward from Greenwich), and a flag that, if nonzero, indicates
that Daylight Saving time applies locally during the appropriate part of
the year.
Only the super-user may set the time of day or time zone.
These routines emulate the 4.3BSD system calls.
RRRREEEETTTTUUUURRRRNNNN
A 0 return value indicates that the call succeeded. A -1 return value
indicates an error occurred, and in this case an error code is stored
into the global variable _e_r_r_n_o.
EEEERRRRRRRROOOORRRRSSSS
The following error codes may be set in _e_r_r_n_o:
[EFAULT] An argument address referenced invalid memory.
[EPERM] A user other than the super-user attempted to set the
time.
[EINVAL] An attempt to change the timezone was made.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
date(1), time(2), stime(2), ctime(3C), see timers(5) for details on the
resolution.
PPPPaaaaggggeeee 2222